const express = require("express");
const router = new express.Router();
const Customers_bookings = require("../models/kehu")
router.post("/kehu", async(req, res) => {
    await Customers_bookings.create(req.body)
    res.setHeader("Access-Control-Allow-Origin", "*");
    res.setHeader("Access-Control-Allow-Headers", "*");
    res.setHeader("Access-Control-Allow-Methods", "*");
    res.send("顾客预约成功")
})
router.get("/kehu_cx", async(req, res) => {
    console.log(req.query);
    const result = await Customers_bookings.find(req.query, {
        _id: 0,
        __v: 0
    });
    res.setHeader("Access-Control-Allow-Origin", "*");
    res.setHeader("Access-Control-Allow-Headers", "*");
    res.setHeader("Access-Control-Allow-Methods", "*");
    res.send(result);
})
module.exports = router;